package org.easy.http.client.util;

/**
 * @Description TODO
 * @Author WuXueLi
 * @Date 16:57 2023/2/4
 * @Version 1.0
 **/
public class ClassLoaderUtils {

    public static ClassLoader getDefaultClassLoader() {
        ClassLoader classLoader = null;
        try {
            classLoader = Thread.currentThread().getContextClassLoader();
        } catch (Throwable e) {
            //无法从当前线程获取到类加载器
        }
        if (classLoader == null) {
            classLoader = ClassLoaderUtils.class.getClassLoader();//从当前类的加载器
            if (classLoader == null) {
                classLoader = ClassLoader.getSystemClassLoader();
            }
        }
        return classLoader;
    }

}
